import {Iaction} from '../../utils/interface';

const initialState = {
    addrList:[],
}


const reducer = (state:any,action:Iaction)=>{
    switch(action.type){
        case 'INIT_ADRESS':
            return {...state,addrList:action.payload}
        case 'DEL_ADRESS':
            // return {...state,msg:action.payload}
            break
        case 'ADD_ADRESS':
            state.addrList.push(action.payload)
            return {...state,addrList:[...state.addrList]}
        default :
            return state
    }
}   

export default (state=initialState,action:Iaction
    )=>reducer(state,action)